﻿<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="NewsManagement.aspx.cs" Inherits="Admin_NewsManagement" Title="News Management" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EatDrinkConnectionString %>"
        SelectCommand="SELECT * FROM [NewsStyle]"></asp:SqlDataSource>
    <script type="text/javascript">
        function OpenPositionedWindow(oButton, url, windowName) {
            var oWnd = window.radopen(url, windowName);
        }
        function openRadWindow(NewsID) 
        {
            var oWnd = radopen("NewsDetails_Admin.aspx?NewsID=" + NewsID, "RadWindow1");
            oWnd.setSize(700, 500);
            oWnd.center();
        }
        function ShowInsertForm()
        {
            var oWnd = radopen("NewsDetails_Admin.aspx" , "RadWindow1");
            oWnd.setSize(700, 500);
            oWnd.center();
        }
    </script>
    <telerik:RadGrid ID="uxNews" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" GridLines="None" Skin="Office2007" 
        PageSize="7" onneeddatasource="uxNews_NeedDataSource1" 
        ondeletecommand="uxNews_DeleteCommand1">
        <HeaderContextMenu Skin="Office2007" EnableTheming="True">
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </HeaderContextMenu>
        <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
        <MasterTableView DataKeyNames="NewsID" CommandItemDisplay="TopAndBottom">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px" Font-Bold="true"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px" Font-Bold="true"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"NewsID")%>'); return false;">
                            Edit</a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="NewsTitle" HeaderText="News Title" UniqueName="News Title">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="NewsShort" HeaderText="News Short" UniqueName="News Short">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" ImageUrl='<%# Eval("NewsImageName", "~/Images/News/{0}") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete"
                    ConfirmDialogType="RadWindow" ConfirmText="Are you sure you would like to delete this?"
                    ConfirmTitle="Delete">
                </telerik:GridButtonColumn>
            </Columns>
            <CommandItemTemplate>
                <a href="#" onclick="ShowInsertForm(); return false;" style="font-size: 25; color: #008080">
                    Add New Record</a>
            </CommandItemTemplate>
        </MasterTableView>
        <FilterMenu EnableTheming="True">
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </FilterMenu>
    </telerik:RadGrid>
    <telerik:RadWindowManager ID="InfoBox" runat="server" Width="900" Height="530" VisibleStatusbar="false"
        Behaviors="Close, Move, Resize , Maximize, Minimize" Skin="Office2007">
    </telerik:RadWindowManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
        Width="75px">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="uxNews">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="uxNews" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
